
import React from 'react';
import PropTypes from 'prop-types';
import {Card, Table} from 'antd';
import {TABLE} from '../constants';

// eslint-disable-next-line react/prefer-stateless-function
class ExpandedRowTablePanel extends React.PureComponent {
    render() {
        const {formatMessage} = this.props.intl;
        const columns = [
            {
                title: formatMessage({
                    id: 'queryPanel.column.serialNumber',
                    defaultMessage: '序号'
                }),
                dataIndex: 'serialNumber',
                sorter: true,
            },
            {
                title: formatMessage({
                    id: 'queryPanel.column.optionName',
                    defaultMessage: '选项名称'
                }),
                dataIndex: 'optionName',
            },
        ];
        return (
            <Card>
                <Table
                    className="white-space-nowrap"
                    rowKey="id"
                    dataSource={this.props.data}
                    columns={columns}
                    pagination={false}
                    {...TABLE}/>
            </Card>
        );
    }
}
ExpandedRowTablePanel.propTypes = {
    data: PropTypes.array,
    intl: PropTypes.object,
};

export default ExpandedRowTablePanel;
